/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode() : val(0), left(nullptr), right(nullptr) {}
 *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
 *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
 * };
 */
class Solution {
public:
    bool examina(TreeNode* rl,TreeNode* rr){
        if(rl==NULL&&rr==NULL)  return true;
        else if(rl==NULL||rr==NULL) return false;
        else if(rl->val!=rr->val) return false;
        return examina(rl->left,rr->right)&&examina(rl->right,rr->left);
    }
    bool isSymmetric(TreeNode* root) {
        return examina(root->left,root->right);
    }
};
